<template>
<div style="padding: 20px">
  <div><span class="add" style="float: right" @click="$router.push('/Addmaterials')">添加物品信息</span></div>
  <br>
  <br>
  <table style="width: 800px;text-align: center;margin-left: 50px">
    <tr style="background-color: #b0e0e688">
      <th>物品名称</th>
      <th>规格</th>
      <th>生产厂家</th>
      <th>单价</th>
      <th>修改</th>
      <th>删除</th>
    </tr>
    <tr v-for="(material,matindex) in materialing" :key="matindex">
      <td>{{material.Itemname}}</td>
      <td>{{material.Specifications}}</td>
      <td>{{material.Manufacturer}}</td>
      <td>{{material.Price | myfilter}}</td>
      <td><el-button @click="$router.push('/Jurisdiction')">修改</el-button></td>
      <td><el-popconfirm title="这是一段内容确定删除吗？">
        <el-button slot="reference">删除</el-button>
      </el-popconfirm>
      </td>
    </tr>
  </table>

  <table style="width: 800px;text-align: center;margin-left: 50px;margin-top: 150px">
    <tr style="background-color: #b0e0e688">
      <th>物品名称</th>
      <th>规格</th>
      <th>生产厂家</th>
      <th>单价</th>
      <th>修改</th>
      <th>恢复</th>
    </tr>
    <tr>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
      <td><el-button @click="$router.push('/Jurisdiction')">修改</el-button></td>
      <td><el-popconfirm title="这是一段内容确定恢复吗？">
        <el-button slot="reference">恢复</el-button>
      </el-popconfirm>
      </td>
    </tr>
  </table>
</div>
</template>

<script>
export default {
  name: "MatAdministration",
  data(){
    return{
      materialing:{}
    }
  },
  filters:{
    myfilter(val){
      return  val.toFixed(2)+'元';
    }
  },
  created() {
    this.$axios.get("/api/material/materials").then(res => {
      console.log(res);
      if(res.data.status===1){
        this.materialing=res.data.data;
      }
    })

  },
}
</script>

<style scoped>

</style>